package Vivo;

import java.util.*;

public class Main1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int len = sc.nextInt();
            int[] useArray = new int[len];
            for (int i = 0; i < len; i++) {
                int used = sc.nextInt();
                useArray[i] = used;
            }
            int res = 0;

            if(useArray[0] == 0){
                
            }else{
                for (int i = 1; i < len-1; i++) {
                    if(useArray[i]==0&&useArray[i-1]==0&&useArray[i+1]==0){
                        res++;
                        useArray[i]=1;
                    }
                }
            }


            // System.out.println(Arrays.toString(useArray));
        }
    }
}
